cmake_minimum_required(VERSION 3.16)
project(sigma_sdk)

set(CMAKE_CXX_STANDARD 11)

# 添加运行输出代码版本
set(COMMIT_HASH "")
set(BRANCH_NAME "")
find_package(Git QUIET)
if(GIT_FOUND)
    execute_process(
            COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H
            OUTPUT_VARIABLE COMMIT_HASH
            OUTPUT_STRIP_TRAILING_WHITESPACE
            ERROR_QUIET
            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    execute_process(
            COMMAND ${GIT_EXECUTABLE} symbolic-ref --short -q HEAD
            OUTPUT_VARIABLE BRANCH_NAME
            OUTPUT_STRIP_TRAILING_WHITESPACE
            ERROR_QUIET
            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
endif()

execute_process(
        COMMAND bash "-c" "git log|head -n 1|awk '{printf $2}'"
        OUTPUT_VARIABLE GIT_COMMIT
)

add_definitions(-DGIT_COMMIT_SHA1="${COMMIT_HASH}")
add_definitions(-DGIT_BRANCH_NAME="${BRANCH_NAME}")


include_directories(include)
aux_source_directory(src SRC)
# aux_source_directory(src/guidance_filter FILTER)

find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIRS})

add_subdirectory(include/geo lib)
link_directories(lib)

#获取图像数据
add_subdirectory(examples/01_recv_image)

#获取飞控消息
add_subdirectory(examples/02_recv_px4_message)

#offboard模式控制飞机飞行
add_subdirectory(examples/03_move_uav_on_offboard)

#通过zmq获取渲染中的障碍物、目标信息
add_subdirectory(examples/04_get_obstacle_info)

#通过zmq控制车辆运动
add_subdirectory(examples/05_move_car)

#使用sdk接口获取渲染中的障碍物、目标信息
add_executable(zmq_interface_demo zmq_interface_demo.cpp ${SRC})
target_link_libraries(zmq_interface_demo pthread zmq)

# dubins
add_executable(dubins dubins.cpp ${SRC}
                include/geo/geo.cpp
                include/geo/geo.h)
target_link_libraries(dubins pthread zmq)

# gps terminal guidance
add_executable(gps_tmg gps_tmg.cpp ${SRC} 
                                src/guidance_filter/BlosSim.cpp
                                src/guidance_filter/PosFilter.cpp)
target_link_libraries(gps_tmg pthread zmq ecl_geo)


